/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.registration.business.security.entity;

import java.io.Serializable;
import static java.lang.Boolean.FALSE;
import java.util.Date;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
 *
 * @author Innotommy91
 */
public class FriendId implements Serializable {
    
    public String sender;
    public String receiver;
    public Date creationTime;
    

    public FriendId() {}
    
    public Date getDate()
    {
        return this.creationTime;
    }
    
    public void setDate(Date value)
    {
        this.creationTime=value;
    }
    public String getSender()
    {
    return this.sender;
    }
    public String getReceiver()
    {
    return this.receiver;
    }

    public void setSender(String sender)
    {
    this.sender=sender;
    }
    public void setReceiver(String receiver)
    {
    this.receiver=receiver;
    }

    
    
    
    public FriendId(String send,String rec,Date value) {
        this.sender= send;
        this.receiver=rec;
        this.creationTime=value;   
    }

    public boolean equals(Object otherOb) {
        if (this == otherOb) {
            return true;
        }
        if (!(otherOb instanceof FriendId)) {
            return false;
        }
        FriendId other = (FriendId) otherOb;
        return (
                    (sender==null?other.sender==null:sender.equals
                    (other.sender)
                    )
                &&
                (receiver==null?other.receiver==null:receiver.equals
                    (other.receiver))
                );
    }

    public int hashCode() {
        return (
                    (sender==null?0:sender.hashCode())
                    ^
                    (receiver==null?0:receiver.hashCode()
                ));
    }

    public String toString() {
        return "" + sender + "-" + receiver+"-" + creationTime;
    }
}

